<template>
  <div class="popup">
    <a-modal
      :title="title"
      ok-text="确 认"
      cancel-text="取 消"
      :visible="showPopup"
      :confirm-loading="confirmLoading"
      @ok="handleClose(true)"
      @cancel="handleClose(false)"
    >
      <slot>这个一个antd对话框的文字</slot>
    </a-modal>
  </div>
</template>

<script>
// showModule
// handleClose
import elDragDialog from "@/directive/el-drag-dialog";
export default {
  directives: {
    elDragDialog,
  },
  name: "Popup",
  props: {
    showPopup: {
      type: Boolean,
      default: false,
    },
    title: String,
    width: {
      type: String,
      default: "600px",
    },
    top: {
      type: String,
      default: "10%",
    },
  },
  data() {
    return {
      confirmLoading: false,
    };
  },
  created() {},
  methods: {
    handleClose(val) {
      const that = this;
      this.$emit("sesionCallback", {
        isConfirm: val,
        operation(success) {
          that.confirmLoading = true;
          new Promise((resolve, reject) => {
            success(resolve, reject);
          }).then((res) => {
            that.confirmLoading = res;
          });
        },
      });
    },
  },
};
</script>


<style lang="scss">
</style>